package com.aye.formatconversion.controller;
//
//import com.aye.formatconversion.service.DirectoryService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import java.nio.file.Path;
//import java.util.List;
//
//@RestController
//@RequestMapping("/api/directories")
//public class DirectoryController {
//
//    @Autowired
//    private DirectoryService directoryService;
//
//    @GetMapping("/list")
//    public List<String> listDirectories(@RequestParam String path) {
//        return directoryService.listDirectories(path);
//    }
//
//    @PostMapping("/select")
//    public String selectDirectories(@RequestParam String dir1, @RequestParam String dir2) {
//        // 这里可以添加处理逻辑，比如比较两个目录的内容等
//        return "Selected directories: " + dir1 + " and " + dir2;
//    }
//}

import com.aye.formatconversion.entity.DirectoryNode;
import com.aye.formatconversion.service.DirectoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

import org.springframework.web.bind.annotation.RestController;

@RestController
public class DirectoryController {

    @Autowired
    private DirectoryService directoryService;

    @GetMapping("/subDirectories")
    public List<DirectoryNode> getSubDirectories(@RequestParam String path) {
        return directoryService.getSubDirectories(path);
    }

    @GetMapping("/directoryInfo")
    public DirectoryNode getDirectoryInfo(@RequestParam String path) {
        return directoryService.getDirectoryInfo(path);
    }
}
